import java.time.LocalDateTime;

public abstract class User {
    private String userId;
    private String username;
    private String password; // 存储MD5加密后的密码
    private UserType userType;
    private String phone;
    private LocalDateTime registerTime;

    public User(String userId, String username, String password, UserType userType, String phone) {
        this.userId = userId;
        this.username = username;
        this.password = MD5Util.encrypt(password); // 加密存储
        this.userType = userType;
        this.phone = phone;
        this.registerTime = LocalDateTime.now();
    }

    // 密码验证（输入明文，加密后比对）
    public boolean verifyPassword(String inputPassword) {
        return this.password.equals(MD5Util.encrypt(inputPassword));
    }

    // 抽象方法：显示角色菜单
    public abstract void showMenu();

    // Getters and Setters
    public String getUserId() { return userId; }
    public String getUsername() { return username; }
    public String getPassword() { return password; }
    public void setPassword(String password) { this.password = password; }
    public UserType getUserType() { return userType; }
    public String getPhone() { return phone; }
    public void setPhone(String phone) { this.phone = phone; }
    public LocalDateTime getRegisterTime() { return registerTime; }
}
    